<?php
namespace app\index\controller;

use think\Db;

class Material
{
    public function get_material($data = [])
    {
        $validate = new \app\index\validate\Material;
        if (!$validate->check($data['data'])) {
            return ret_json($data['command'],[],-1,$validate->getError());
        }

        try{
            $res = Db::table('v_tb_material')
                    ->where('ID',$data['data']['id'])
                    ->select();

            return ret_json($data['command'],$res,0, 'success,查询物料数据成功');
        }catch(\Exception $e) {
            return ret_json($data['command'],[],-99,$e->getMessage());
        }      
    }

    public function update_material($data = [])
    {
        return ret_json($data['command'],[],0,'Material/update_material');
    }
}